FROM ubuntu:18.04
RUN apt-get update
RUN apt-get upgrade --assume-yes
RUN apt-get install wget --assume-yes

#RUN wget http://www.cpan.org/src/5.0/perl-5.18.4.tar.gz
#RUN tar -xzf perl-5.18.4.tar.gz
#RUN apt-get install --assume-yes build-essential
#RUN cd perl-5.18.4 && ./Configure -des -Dprefix=$HOME/localperl
#RUN cd perl-5.18.4 && make
#RUN cd perl-5.18.4 && make install
#RUN perl -v
RUN apt-get install --assume-yes perl
RUN apt-get install --assume-yes apt-utils
RUN apt-get update && apt-get install -y sudo

RUN apt-get install --assume-yes python

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone

ARG user=test

RUN useradd --create-home --no-log-init --shell /bin/bash ${user} \
    && adduser ${user} sudo \
    && echo "${user}:1" | chpasswd

ADD ./gn  /usr/bin/
ADD ./ninja  /usr/bin/
ADD ./install_modules.pl  /

RUN apt-get install --assume-yes mc re2c bc zip u-boot-tools  rsync  bison gcc make build-essential libc6-dev-i386 libncurses-dev wget coreutils diffstat  chrpath cpio
RUN apt-get install --assume-yes gawk git git-core help2man libtool libxml2-dev quilt sed subversion texi2html texinfo  flex libtinfo5 locales
RUN apt-get install --assume-yes texinfo gcc-multilib build-essential  socat   python-pip   xz-utils debianutils iputils-ping  texlive
RUN apt-get install --assume-yes tree dos2unix cvs desktop-file-utils docbook-utils fakeroot g++   help2man libgmp3-dev libmpfr-dev libreadline6-dev libtool libxml2-dev python-pysqlite2 quilt sed subversion texi2html texinfo unzip uuid-dev  libssl-dev 

RUN pip install enum34
RUN update-alternatives --install /usr/bin/python  python /usr/bin/python2  2700
# RUN update-alternatives --install /usr/bin/python  python /usr/bin/python3  3600

#ENV LANG en_US.UTF-8
#ENV  LC_ALL en_US.UTF-8
ENV LANG C.UTF-8
ENV  LC_ALL C

RUN perl /install_modules.pl 
RUN rm -rf /install_modules.pl

RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

USER  ${user}
